package com.gitee.shoes.crawler.core;

import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;

import java.util.regex.Pattern;

/**
 * @author LYH
 */
public class ApiRequestUtils {
    private static final Pattern SIZE_PATTERN = Pattern.compile("[\\w\\.⅓⅔]+");

    public static String handlerSize(String size) {
        if (size == null) {
            return null;
        }
        size = StrUtil.replace(size, "1/3", "⅓");
        size = StrUtil.replace(size, "2/3", "⅔");
        size = StrUtil.cleanBlank(size);
        return ReUtil.getGroup0(SIZE_PATTERN, size);
    }
}
